var ua = navigator.userAgent, app = navigator.appVersion;

function pcBrowserVersion(ua) {
    var isIE = ua.indexOf("compatible") > -1 && ua.indexOf("MSIE") > -1; //判断是否IE<11浏览器
    var isEdge = ua.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
    var isIE11 = ua.indexOf('Trident') > -1 && ua.indexOf("rv:11.0") > -1;//判断是否是ie11
    if (isIE) {
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(ua);
        var fIEVersion = parseFloat(RegExp["$1"]);
        if (fIEVersion == 7) {
            return ['IE', 7];
        } else if (fIEVersion == 8) {
            return ['IE', 8];
        } else if (fIEVersion == 9) {
            return ['IE', 9];
        } else if (fIEVersion == 10) {
            return ['IE', 10];
        } else {
            return ['IE', 6];//IE版本<=7
        }
    } else if (isEdge) {
        return ['IE', 'edge'];//edge
    } else if (isIE11) {
        return ['IE', 11]; //IE11
    } else {//不是ie浏览器
        if (/Firefox/g.test(ua)) {
            ua = ua.split(" ");
            ret = "Firefox|" + ua[ua.length - 1].split("/")[1];
        } else if (/MSIE/g.test(ua)) {
            ua = ua.split(";");
            ret = "IE|" + ua[1].split(" ")[2];
        } else if (/Opera/g.test(ua)) {
            ua = ua.split(" ");
            ret = "Opera|" + ua[ua.length - 1].split("/")[1];
        } else if (/Chrome/g.test(ua)) {
            ua = ua.split(" ");
            ret = "Chrome|" + ua[ua.length - 2].split("/")[1];
        } else if (/^apple\s+/i.test(navigator.vendor)) {
            ua = ua.split(" ");
            ret = "Safair|" + ua[ua.length - 2].split("/")[1];
        } else {
            ret = ["未知浏览器", "未知版本号"];
        }
        return ret.split("|")
    }
}

var b = pcBrowserVersion(ua);
if (b && b.length && b.length == 2) {
    if (b[0] == "IE" && b[1] && b[1] - 0 < 10) {
        window.location.href = "/notSupportIE.html";
    }
    /*else if(b[0] == "Safair"){//没有mac不好测试
        window.location.href="/notSupportIE.html";
    }*/
}

